#pragma once

//#define WM_LOGIN WM_USER+100
#define WM_RESPONSE WM_USER+101

struct IController
{
	virtual void OnResponse(unsigned char type, char* res, int len) = 0;
};

class CMyNetwork;
class CUser;
class CMyController : public IController
{
public:
	CMyController();
	~CMyController(void);


public:
	void Register(HWND hWnd, LPCTSTR lpszUserName, LPCTSTR lpszPassword);
	void Login(HWND hWnd, LPCTSTR lpszUserName, LPCTSTR lpszPassword);
	void Logout(HWND hWnd);
	void SendMsg(HWND hWnd, int toUser, int fromUser, LPCTSTR lpszMsg);
	void SendMsgToAll(HWND hWnd, int fromUser, LPCTSTR lpszMsg);
	void TermServer(HWND hWnd);
	void SendData(HWND hWnd, int type, LPCTSTR lpszP1, LPCTSTR lpszP2, LPCTSTR lpszP3, LPCTSTR lpszP4);
	void OnResponse(unsigned char type, char* res, int len);

	CUser* GetUsers();


private:
	HWND m_hLoginWnd;
	CMyNetwork *m_pNetwork;
	CUser *m_pUser;

	int m_uid;
};
